Repository navigation
fix: skip managed-proxy model-info lookup when no key is available - #5456
Draft
daviskay75 wants to merge 3 commits into
Draft
daviskay75 wants to merge 3 commits into
daviskay75 wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #5454
Cause
_get_model_info_from_litellm_proxybuiltheaders = {}and emittedGET {base_url}/v1/model/infoeven when no API key was available. Against themanaged proxy (which always requires auth) that is a guaranteed
401, and theSDK silently fell back to static metadata — while every keyless LLM
construction / profile load / validation re-emitted the doomed request (see
also #4098).
Fix
Skip the request when no key is available (
None/empty/blank — none canauthenticate) and the target is the managed OpenHands proxy, recognized via
the existing
is_openhands_proxy_base_urlhelper (both base-URL forms,normalized). Callers fall through to the static fallbacks. Generic/custom
proxies are deliberately unchanged: an open proxy may legitimately serve model
info without credentials. Keyed requests — including invalid keys, whose real
401 stays visible — are unchanged.
Tests
tests/sdk/llm/test_model_info_keyless.py(6 tests): managed None/empty/blankand
/v1/-suffixed URLs emit nothing and returnNone; managed keyed requeststill sends
Authorization: Bearer …and returns the matchedmodel_info;generic keyless lookup still attempts the request with empty headers.